if [ $# -ne 2 ]; then
	echo "The first parameter is the genename extract from the sam."
	echo "The second parameter is the reference." 
	echo "The .fa file to build the bowtie index."
	echo "Two arguments are needed."
	exit
fi 
echo 'Run Tophat to find all junctions'
READ=$PANF/BrainTran/brain_seq.fastq
#READ="test.fastq"
bowtie-build $2 $1
#tophat -a 20 -m 2 -p 16 -o $1 --segment-length 50 $1 $READ
#tophat -p 16 -o $1 $1 ../$READ
echo 'Exit Tophat'
cd $1
if test -s left_kept_reads.fq ; then
    \rm left_kept_reads.fq*
fi
python ~/SCRIPT/one_contig_one_junctions_file.py $2.sam $2
if ! test $2.bed ; then 
	echo '$2.bed is not created'
fi
/SHELL/PerM_TranSEQ.sh $1 $READ




